#include "FileReceiveManager.h"
#include "FileReceiver.h"

FileReceiveManager::FileReceiveManager() :
		Manager(FileReceiveManage)
{

}

void FileReceiveManager::AddTask(void *task)
{
	if (_taskMap.count() <= _capacity)
	{
		FileReceiver *receiver = new FileReceiver((int)task, 6715);
		if (receiver != NULL)
		{
			if (receiver->Initialize())
			{
//				connect(receiver, SIGNAL(sigError(QString)), this, SLOT(DeleteTask(void*)));
				connect(receiver, SIGNAL(sigDisconnected()), this, SLOT(OnComplete()));
			}
		}
		else
			emit sigNotice("FileReceiverManager::AddTask() : not enough memory");
	}
	else
		emit sigNotice("FileReceiveManager::AddTask() : max capacity");
}

void FileReceiveManager::DeleteTask(void *task)
{

}

void FileReceiveManager::OnComplete()
{

}
